<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
   
</head>
<body>  
    <!-- 组件之间的通信 父传子 -->
    <div id="app">
        <child-com :get-msg="sendMsg"></child-com>
    </div>
    <script>
        Vue.component("childCom",{
            template:` 
                <div style="background : red">
                    <h1> {{ getMsg }} </h1>
                </div>    
            `,
            props: {
                getMsg:{
                    type: String,
                    default:"123dd"
                }
            }
        })
        var app = new Vue({
            el: "#app",
            data: {
                sendMsg:"hello world"
            }
        });
        // app相当于一个父组件 html文件相当于一个根组件
    </script>
</body>
</html>